package org.bsc.mgwt.client;

import org.bsc.mgwt.client.activity.MVPExplorerActivity;
import org.bsc.mgwt.client.activity.MVPTabActivity;
import org.bsc.mgwt.client.activity.MVPTabView2Activity;
import org.bsc.mgwt.client.place.MVPExplorerPlace;
import org.bsc.mgwt.client.place.MVPTabPlace;
import org.bsc.mgwt.client.place.MVPTabView2Place;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;

public class TabletMainActivityMapper implements ActivityMapper {

	private final ClientFactory clientFactory;

	public TabletMainActivityMapper(ClientFactory clientFactory) {
		this.clientFactory = clientFactory;

	}

	@Override
	public Activity getActivity(Place place) {
		if( place instanceof MVPTabPlace ) {
			
			return new MVPTabActivity(clientFactory);
			
		}
		if( place instanceof MVPTabView2Place ) {
			
			return new MVPTabView2Activity(clientFactory);
			
		}
		if( place instanceof MVPExplorerPlace ) {
			
			return new MVPExplorerActivity(clientFactory);
		}
		return null;

	}

}
